package com.bilibili.juc.locks_2.demo_eight;

import java.util.concurrent.TimeUnit;

/**
 * 6 有两个静态同步方法，有2部手机，请问先打印邮件还是短信
 *
 * @author 陈賝
 * @since 2024/5/28 16:41
 */
public class demo_6 {
    public static void main(String[] args) throws InterruptedException {
        PhoneStatistic phone = new PhoneStatistic();
        PhoneStatistic phone2 = new PhoneStatistic();

        new Thread(() -> {
            phone.sendEmail();
        }, "a").start();

        //暂停毫秒,保证a线程先启动
        TimeUnit.MILLISECONDS.sleep(200);

        new Thread(() -> {
            phone2.sendSMS();
            //phone.hello();
//            phone2.sendSMS();
        }, "b").start();
    }
}
//-----sendEmail
//-----sendSMS
